import {Injectable} from '@angular/core';
import {Subject} from "rxjs";
import {delay} from "rxjs/operators";

@Injectable({
  providedIn: 'root'
})
export class TeacherService {

  private _who = new Subject<string>();
  private _whoErr = new Subject<string>();

  private _whoValue = null;

  public who = this._who.asObservable().pipe(delay(0));
  public whoErr = this._whoErr.asObservable();

  public likeMe(name: string): void {
    this._who.next(name);
  }

  public likeMeError(name: string): void {
    this._whoErr.next(name);
  }

  set likeMeValue(name: string) {
    this._whoValue = name;
  }

  get likeMeValue() {
    return this._whoValue
  }

  constructor() {
  }
}
